//logo维护
$(function(){
	var insertText ='<input type="file" id="picChangeId" name="pic" size="30" onchange="change_photo()" />';
	document.getElementById("picId1").innerHTML=insertText;
	//编辑
	$("#saveId").click(function(){
		if($("#formId").form('validate')){
			//var img = document.getElementById("filebox_file_id_1").value;
			if($("#pkId").val()==""){ //非修改情况
				var img = document.getElementById("picChangeId").value; //第二种普通方式
				if(img == ""){
					$.messager.alert('提示','请选择图片',"",function(){
					});
					return;
				}
			}
			upLoadFile(); //上传图片
		}
	});
	
   
});

//上传图片  
function upLoadFile() {
	//$("#formId").attr("action",$WEB_ROOT_PATH+'/w/whn001/addTvegetableImage');
	//$("#formId").submit();
	var options ={
			type:'POST',
			url:$WEB_ROOT_PATH+'/whlogo01/addSeedImage',
			contentType : 'multipart/form-data',
			success:function(){
				
			},
			error:function(){
				return false;
			}
	};
	$("#formId").ajaxSubmit(options);
}

function clearForm(){ //清空表单
	$("#formId").form("clear");
	$("#Img").attr("src","/logo/dpsc.png");
}

/**
 * 预览图片
 */
function change_photo(){
	PreviewImage2($("#picChangeId")[0], 'Img', 'Imgdiv');
}
